package com.zkc.blog.exception;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/***
 * 异常处理类
 * @author Administrator
 *
 */
@ControllerAdvice
public class GlobalExceptionController {

	@ExceptionHandler(value=Exception.class)
	public ModelAndView DefaultExceptionAdvice(HttpServletRequest req,Exception e){
		ModelAndView mv=new ModelAndView();
		mv.addObject("exception", e);
		mv.addObject("url",req.getRequestURL());
		mv.setViewName("errorPage");
		return mv;
	}
	
}
